package com.njupt.webapp.tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * 清除内容中的html标签代码。
 *
 */
public class CleanHtmlTag extends TagSupport {

	private String str;
	private String scope;
	
	public String getScope() {
		return scope;
	}
	public void setScope(String scope) {
		this.scope = scope;
	}
	public void setStr(String strEl){
		this.str = strEl;
	}
	public int doStartTag() throws JspException {
		String s = (String)TagUtils.evaluate("str",str,String.class, this, pageContext); 
		String ss = s.replaceAll("<[^>]*>",	""); //匹配所有<>中没有>的所有字符都换成"";
		TagUtils.saveToContext(this,pageContext,scope,ss);
		return super.doStartTag();
	}
}

